using System.Collections.ObjectModel;
using System.Windows.Media;

namespace Sensor.UI.Utils
{
    /// <summary>
    /// 颜色集合类，用于存储和管理Color对象
    /// </summary>
    public class ColorCollection : Collection<Color>
    {
        /// <summary>
        /// 初始化ColorCollection实例
        /// </summary>
        public ColorCollection()
        {
        }

        /// <summary>
        /// 使用指定的颜色列表初始化ColorCollection实例
        /// </summary>
        /// <param name="colors">初始颜色列表</param>
        public ColorCollection(IEnumerable<Color> colors)
        {
            if (colors != null)
            {
                foreach (var color in colors)
                {
                    Add(color);
                }
            }
        }

        /// <summary>
        /// 获取或设置指定索引处的颜色
        /// </summary>
        /// <param name="index">颜色索引</param>
        /// <returns>指定索引处的颜色</returns>
        public new Color this[int index]
        {
            get => base[index];
            set => base[index] = value;
        }
    }
}